package com.bluetrum.abmate.eq;

import androidx.annotation.StringRes;

import com.bluetrum.abmate.R;

import java.util.ArrayList;
import java.util.List;

public class PresetEqSetting extends EqSetting {

    private static final byte[] EQ_GAINS_DEFAULT = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    private static final byte[] EQ_GAINS_POP     = new byte[] { 3, 1, 0, -2, -4, -4, -2, 0, 1, 2 };
    private static final byte[] EQ_GAINS_ROCK    = new byte[] { -2, 0, 2, 4, -2, -2, 0, 0, 4, 4 };
    private static final byte[] EQ_GAINS_JAZZ    = new byte[] { 0, 0, 0, 4, 4, 4, 0, 2, 3, 4 };
    private static final byte[] EQ_GAINS_CLASSIC = new byte[] { 0, 8, 8, 4, 0, 0, 0, 0, 2, 2 };
    private static final byte[] EQ_GAINS_COUNTRY = new byte[] { -2, 0, 0, 2, 2, 0, 0, 0, 4, 4 };

    public static final PresetEqSetting EQ_SETTING_DEFAULT = new PresetEqSetting(R.string.function_equalizer_preset_default, EQ_GAINS_DEFAULT);
    public static final PresetEqSetting EQ_SETTING_POP = new PresetEqSetting(R.string.function_equalizer_preset_pop, EQ_GAINS_POP);
    public static final PresetEqSetting EQ_SETTING_ROCK = new PresetEqSetting(R.string.function_equalizer_preset_rock, EQ_GAINS_ROCK);
    public static final PresetEqSetting EQ_SETTING_JAZZ = new PresetEqSetting(R.string.function_equalizer_preset_jazz, EQ_GAINS_JAZZ);
    public static final PresetEqSetting EQ_SETTING_CLASSIC = new PresetEqSetting(R.string.function_equalizer_preset_classic, EQ_GAINS_CLASSIC);
    public static final PresetEqSetting EQ_SETTING_COUNTRY = new PresetEqSetting(R.string.function_equalizer_preset_country, EQ_GAINS_COUNTRY);
    // Flag
    public static final PresetEqSetting EQ_SETTING_ADD = new PresetEqSetting(R.string.function_equalizer_custom_add, EQ_GAINS_DEFAULT);

    public PresetEqSetting(@StringRes int nameResId, byte[] gains) {
        super("Preset", gains);
        this.nameResId = nameResId;
        this.isCustom = false;
    }

    public static List<EqSetting> allPresetEqSettings() {
        return new ArrayList<EqSetting>() {{
            add(EQ_SETTING_DEFAULT);
            add(EQ_SETTING_POP);
            add(EQ_SETTING_ROCK);
            add(EQ_SETTING_JAZZ);
            add(EQ_SETTING_CLASSIC);
            add(EQ_SETTING_COUNTRY);
        }};
    }

}
